s="helloworld"
for i in range(0,len(s)):
    print(i,s[i],end="\t\t")
print()

print(s[0:10:2]) #切片

print("\n","-"*40,"\n")

list1=["hello","world",1314,520]
print(list1)

for i in list1:
    print(i)
print()

for i in range(0,len(list1)):
    print(i," ",list1[i],end="\t\t")
print()

for i,j in enumerate(list1,start=3):
    # i 是序号不是索引！“start=1”或者直接写“1”修改了，没有默认0
    print(i, " ",j, end="\t\t")
print("\n","-"*40)

# 列表生成式
lst=[i for i in range(1,11)]
print(lst)

lst=[i*i for i in range(1,11) if i%2==0]
print(lst)

import random
lst=[random.randint(1,100) for _ in range(5) ]
print(lst)
#二维列表
print("\n","-"*40)
lst=[ ["城市","环比","同比"],["北京",102,103],["上海",104,504] ]
for i in lst:
    for j in i:
        print(j,end="\t")
    print()
print()

lst=[[j for j in range(5)] for i in range(4)]
print(lst)